﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PPIMobileInterface.Logic;
using PPIMobileInterface.Entities;
using PPIDesktopClient.Logic;

namespace PPIDesktopClient.Entities
{
    public class EMobileDatabase
    {
        #region Fields

        private List<EVendor_Visit_XMissionStructure> m_assets;
        private string m_ConnectionString;

        #endregion

        #region Public
        public string ConnectionString
        {
            get
            {
                return m_ConnectionString;
            }
        }
        public List<EVendor_Visit_XMissionStructure> Assets
        {
            get
            {
                return m_assets;
            }
        }

        public void LoadAssets()
        {
            List<EVisit> _Visits = LogicLayer.LoadAllCompleteVisits(m_ConnectionString, true);
            foreach (EVisit v in _Visits)
            {
                m_assets.Add(LVendor_Visit_XMissionStructure.GetStructureFromMobileVisit(v,m_ConnectionString));
            }
        }

        #endregion

        #region Constructor

        public EMobileDatabase(string connectionString)
        {
            m_ConnectionString = connectionString;
            m_assets = new List<EVendor_Visit_XMissionStructure>();
            LoadAssets();
        }

        #endregion

    }
}
